package hotel.data;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5Creator 
{
	public static String MD5(String md5) 
	{
		StringBuffer sb = new StringBuffer();
		
		try 
		{
			MessageDigest md = MessageDigest.getInstance("MD5");
			byte[] array = md.digest(md5.getBytes());
			
			for (int i = 0; i < array.length; ++i) 
			{
				sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1,3));
			}
		}
		catch (NoSuchAlgorithmException e){} 
		
		return sb.toString();
	}

}
